#pragma once

#include <QRect>
#include <QColor>
#include <QByteArray>
#include <QPaintDevice>
#include <QSharedPointer>

class Meta
{
public:
    virtual QSize sizeHint() const = 0;
    virtual void paint(QPaintDevice* pd, const QRect& rect) const = 0;

    void SetColor(const QColor& color) { _color = color; }
    QColor GetColor() const { return _color; }

    QByteArray PropertyToStream();
    void StreamToProperty(const QByteArray& str);

    QString Time() { return _time; }
    void SetTime(const QString& time) { _time = time; }

    uint32_t Id() const { return _id; }

protected:
    Meta();
    Meta(uint32_t id);

    uint32_t _id;
    QString _time;
    QColor _color{ 0XE3CCC4 };
};

uint32_t GenId();

using SharedMeta = QSharedPointer<Meta>;
Q_DECLARE_METATYPE(SharedMeta);